<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>

  </style>
</head>
<body>
  <div>11</div>
  <div>22</div>
  <div>33</div>
  <div>44</div>
  <script>
    // 通过标签获取元素
    var di = document.getElementsByTagName("div")
    console.log(di);
    // HTMLCollection html元素的数组，是个伪数组
      // 遍历数组
      for (var i = 0;i <= di.length-1;++i){
        console.log(di[i]);
      }
      di[0].style.background = "red"
  </script>
</body>
</html>